PostgreSQL infrastructure: per-module DBs, initdb, CNPG backup#11
Open
PostgreSQL infrastructure: per-module DBs, initdb, CNPG backup#11
Conversation
Support the API's migration from raw SQL dbScripts to drizzle-kit managed migrations with dual MySQL/PostgreSQL dialect support. - docker-compose: bind-mount tools/ and drizzle/ into API container - Dockerfile.prod: COPY drizzle/ directory into prod image - initdb.sh: rewrite to apply drizzle migration SQL files from drizzle/<dialect>/<module>/ instead of per-table SQL from dbScripts/; MySQL stored procs loaded separately by name whitelist - load-tests: fix unqualified table name, add PG seed variant - repos.yaml: update B1Admin branch reference Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Prefix services INSERT with attendance. schema (was inserting into wrong schema since PG uses schemas not separate databases) - Add 2,000 groupMembers via generate_series (matching MySQL version) - Add members count to verification query Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Next.js dev mode compiles on first request. In CI runners this exceeds 180s consistently — failing on both main and PR branches. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
B1App returns 500 on all routes due to missing @/styles/vendor/pages.css in ChurchApps/B1App upstream. This blocks the wait-ready health check indefinitely. - Add WAIT_SERVICES env var to wait-ready.sh for selective checks - Skip B1App wait, E2E tests, and artifact upload in CI - Revert timeout to 180s (sufficient without B1App) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The B1App CSS import issue (missing src/styles/vendor/pages.css) is now fixed on dnplkndll/B1App#fix/missing-vendor-css (upstream PR: ChurchApps/B1App#460). - Add fix/missing-vendor-css to B1App merges in repos.yaml - Restore B1App in wait-ready (was excluded with WAIT_SERVICES filter) - Remove skip comments for B1App E2E tests - Increase WAIT_TIMEOUT to 300s (B1App Next.js cold-compile needs time) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Upstream @churchapps/apphelper-donations@0.6.18 declares a peer dep on @churchapps/helpers@"file:../helpers" which cannot resolve in CI. This matches the same workaround used in the Docker build (commit 3991dc1). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
B1App has an upstream CSS resolution issue that causes 500 errors on startup, blocking the wait-ready script. Since B1Admin E2E tests only need the API and B1Admin services, use WAIT_SERVICES to skip B1App. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tests with retries take ~80min on CI. Increase timeout from 90 to 120 minutes. Add summary step to show pass/fail counts and failed test names in CI logs for easier debugging. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Switch PG from single-DB-with-schemas to per-module databases, matching the MySQL layout for simpler dual-dialect support. - postgres/init/02-create-module-dbs.sql: create 7 per-module databases on first container start - initdb.sh PG section: apply DDL from tools/dbScripts/pg/ to each module's own database (was applying drizzle migrations to schemas) - initdb.sh MySQL section: apply DDL from tools/dbScripts/ (was drizzle) - Both sections: load stored functions after table creation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add optional Barman ObjectStore backup to CNPG cluster template: - S3-compatible endpoint with gzip compression (WAL + data) - ScheduledBackup CRD for daily automated backups (2 AM) - 30-day retention policy - Configured for b1-postgres namespace in values.b1-postgres.yaml Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- _helpers.tpl: connStr uses module name as PG database (not b1stack) - cnpg-cluster.yaml: grant CREATEDB to app user (replaces schema creation — initdb.sh creates per-module databases instead) - Dockerfile.prod: remove stale COPY drizzle/ line Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Api: feat/drizzle-orm → feat/kysely-orm (branch renamed) - B1Admin: remove feat/playwright-e2e-clean (merged upstream as #367) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Infrastructure for dual MySQL/PostgreSQL support in B1Stack.
Changes
docker/api/initdb.sh: Rewritten to support both MySQL and PostgreSQLtools/dbScripts/pg/+ stored functionstools/dbScripts/+ stored procedurespostgres/init/02-create-module-dbs.sql: Docker entrypoint script that creates per-module PG databases on first starthelm/b1stack/templates/cnpg-cluster.yaml: CNPG backup configuration with Barman ObjectStore (S3, gzip, daily schedule)helm/b1stack/values.b1-postgres.yaml: S3 backup config for b1-postgres namespace (30-day retention)Architecture decision
Chose per-module databases over single-DB-with-schemas for PostgreSQL:
getDb()or connection string parsingRelated
Test plan
🤖 Generated with Claude Code